package main

import (
	"./person"
	"fmt"
)

func main() {
	//man := new(person.Man) //声明一个person.Man的指针对象
	//var ip *person.IPerson;
	//man.Say("hello")
	//fmt.Printf("\n")
	////man.Do()
	//man.ManSelfDo()
	//(*ip).Say("my interface\n")
	////ip.Do()
	////v := ip.(*person.Man) //声明一个person.Man的指针对象
	////v.Say("v\n")
	////fmt.Println(&v)
	//fmt.Println(&man)
	//fmt.Println(&ip)
	//var z person.Man
	//fmt.Println(z)
	//v.ManSelfDo()

	fmt.Println("-------------------")
	var m1 person.IPerson = new(person.Man) //产生对象
	var m2  = new(person.Man)
	fmt.Println("m2 is ", m2)
	fmt.Println("m1 is ", m1)
	fmt.Printf("m1 is address:%v\n", &m1)
	m1.Say("m1\n")

	p := m1.(*person.Man) //将m1指向的数据地址，给p(类似于类型转换)
	(*p).Value = "aaa"
	fmt.Println("*p is", *p)
	fmt.Println("&p is address:%v", &p)
	fmt.Println("p is ", p)
	fmt.Println("m1 end is address:%v", m1) //p指向m1
	fmt.Println("p.Value is ", p.Value)
	m1.Say("m1.....\n")

	p1 := m1.(*person.Man)
	fmt.Println("&p1 is ", &p1)
	fmt.Println("p is ", p)
	fmt.Println("p1 == p is", p1 == p) //true

}
